package com.example.spzx.Service.impl;

import com.example.spzx.Mapper.ProductSpecMapper;
import com.example.spzx.Service.ProductSpecService;
import com.example.spzx.model.entity.product.ProductSpec;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ProductSpecServiceImpl implements ProductSpecService {
  @Resource
  private ProductSpecMapper productSpecMapper;
    public PageInfo<ProductSpec> getpage(Integer page, Integer limit){
        PageHelper.startPage(page,limit);
        PageInfo<ProductSpec> pageInfo=new PageInfo<>();
        Page<ProductSpec> page1=productSpecMapper.getlist();
        pageInfo.setTotal(page1.getTotal());
        pageInfo.setList(page1.getResult());
        return pageInfo;

    }
    public     void add(ProductSpec productSpec){
        productSpecMapper.add(productSpec);

    }
    public  void updateById(ProductSpec productSpec){
        productSpecMapper.updatebyid(productSpec);
    }
    public  void delete(Integer id){
        productSpecMapper.delete(id);
    }
}
